package com.sleep.psy.external_server.business.adjustment.service.impl;

import com.sleep.psy.external_server.business.adjustment.entity.AdjustmentPlanRecord;
import com.sleep.psy.external_server.business.adjustment.entity.vo.AddPlanRecordReq;
import com.sleep.psy.external_server.business.adjustment.mapper.AdjustmentPlanRecordMapper;
import com.sleep.psy.external_server.business.adjustment.service.AdjustmentPlanRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sleep.psy.external_server.result.Result;
import com.sleep.psy.external_server.result.ResultUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 调节记录表 服务实现类
 * </p>
 *
 * @author wenliguo
 * @since 2025-08-12
 */
@Service
public class AdjustmentPlanRecordServiceImpl extends ServiceImpl<AdjustmentPlanRecordMapper, AdjustmentPlanRecord> implements AdjustmentPlanRecordService {

    protected Logger logger = LoggerFactory.getLogger(AdjustmentPlanRecordService.class);

    @Autowired
    private AdjustmentPlanRecordMapper planRecordMapper;

    /**
     * 新增调节记录
     * @author wenliguo
     * @date 2025/8/17 16:34
     * @param req 请求参数
     * @return com.sleep.psy.main_server.result.Result
     */
    @Override
    public Result addPlanRecord(AddPlanRecordReq req) {
        AdjustmentPlanRecord record = new AdjustmentPlanRecord();
        record.setPlanId(req.getPlanId());
        record.setUserId(req.getUserId());
        record.setPlanDetailsId(req.getPlanDetailsId());
        record.setContent(req.getContent());
        planRecordMapper.insert(record);
        return ResultUtil.success();
    }
}
